package com.tuanzi.loan.business.repository.collaborate;

import com.tuanzi.loan.business.entity.collaborate.NewCollaborateChannelRatio;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * User: liangZongXi
 * Create time: 16:35 2018/9/18
 * Description:
 */
public interface CollaborateChannelRatioRepository extends JpaRepository<NewCollaborateChannelRatio, Integer> {
    NewCollaborateChannelRatio findCollaborateChannelRatioByChannelId(Integer channelId);

    List<NewCollaborateChannelRatio> findByChannelIdIn(List<Integer> channelList);

    @Modifying
    @Query(value = "UPDATE NewCollaborateChannelRatio SET ratio = tomorrowRatio")
    void updateRatioFromTomorrowRatio();
}
